//
//  ILGThirdDelegate.h
//  GameDemo
//
//  Created by Happy on 1/16/17.
//  Copyright © 2017 Happy. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ILGShare.h"
#import "ILGLoginManager.h"

#if __has_include("WXApi.h")
#import "WXApi.h"
#define ILGWXSDKIncluded
#endif

#if __has_include("WeiboSDK.h")
#import "WeiboSDK.h"
#define ILGWBSDKIncluded
#endif

#if __has_include(<TencentOpenAPI/TencentOAuth.h>)
#import <TencentOpenAPI/TencentOAuth.h>
#import <TencentOpenAPI/TencentOAuthObject.h>
#import <TencentOpenAPI/TencentMessageObject.h>
#import <TencentOpenAPI/QQApiInterfaceObject.h>
#import <TencentOpenAPI/QQApiInterface.h>
#define ILGQQSDKIncluded
#endif

#if __has_include("FBSDKCoreKit/FBSDKCoreKit.h")
#import "FBSDKCoreKit/FBSDKCoreKit.h"
#import "FBSDKLoginKit/FBSDKLoginKit.h"
#define ILGFacebookSDKIncluded
#endif

// 第三方类型
typedef NS_ENUM(NSInteger, ILGThirdType) {
    ILGThirdTypeWeiXin = 1,
    ILGThirdTypeWeiBo = 2,
    ILGThirdTypeQQ = 3,
    ILGThirdTypeFacebook = 4,
    ILGThirdTypeOther = 5
};
typedef void(^ILGLoginCallback)(NSError *error, NSDictionary *result, ILGThirdType loginType);
typedef void(^ILGShareCallback)(NSError *error, NSDictionary *result, ILGThirdType shareType);

@interface ILGThirdDelegate : NSObject
+ (ILGThirdDelegate *)sharedInstance;

@property (nonatomic, copy) NSString *wxAppId;
@property (nonatomic, copy) NSString *wbAppId;
@property (nonatomic, copy) NSString *qqAppId;

@property (nonatomic, copy) ILGLoginCallback loginCallback;
@property (nonatomic, copy) ILGShareCallback shareCallback;

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url;
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation;
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options;

+ (BOOL)isWXAppInstalled;
+ (void)openWeiXin;

+ (BOOL)isQQAppInstalled;
+ (void)openQQ;

@end


#ifdef ILGWXSDKIncluded
@interface ILGThirdDelegate (WeiXin) <WXApiDelegate>

@end
#endif


#ifdef ILGWBSDKIncluded
@interface ILGThirdDelegate (WeiBo) <WeiboSDKDelegate>

@end
#endif


#ifdef ILGQQSDKIncluded
@interface ILGThirdDelegate (QQ) <TencentSessionDelegate, QQApiInterfaceDelegate>

@property (nonatomic, strong) TencentOAuth *tencentOAuth;

@end
#endif


#ifdef ILGFacebookSDKIncluded
@interface ILGThirdDelegate (FacebookShare) <FBSDKSharingDelegate>
@end
#endif
